from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
from rest_framework.generics import ListAPIView
from rest_framework.viewsets import ModelViewSet
from apps.meiduo_admin.serializers.permission import PermissionSerializer, ContentTypeSerializer
from apps.meiduo_admin.utils import PageNum


class PermissionViewSet(ModelViewSet):

    queryset = Permission.objects.all().order_by('id')
    serializer_class = PermissionSerializer
    pagination_class = PageNum


class ContentTypeListView(ListAPIView):

    queryset = ContentType.objects.all()
    serializer_class = ContentTypeSerializer